import { ApiProperty } from '@nestjs/swagger'
import { Type } from 'class-transformer'
import { IsEnum, IsInt, IsOptional, IsString } from 'class-validator'
import { PagerDto } from '~/common/dto/pager.dto'
import { WorkStatus, WorkType } from '../entities/wall.entity'

export class QueryWorkDto extends PagerDto {
  @ApiProperty({ description: '作品标题', required: false, example: '英语演讲' })
  @IsOptional()
  @IsString()
  workTitle?: string

  @ApiProperty({ description: '作品类型：2-视频，3-音频', enum: WorkType, required: false })
  @IsOptional()
  @IsEnum(WorkType, { message: '无效的作品类型' })
  @Type(() => Number)
  workType?: WorkType

  @ApiProperty({ description: '学生ID', required: false, example: 1 })
  @IsOptional()
  @IsInt({ message: '学生ID必须是整数' })
  @Type(() => Number)
  studentId?: number

  @ApiProperty({ description: '班级ID', required: false, example: 1 })
  @IsOptional()
  @IsInt({ message: '班级ID必须是整数' })
  @Type(() => Number)
  classId?: number

  @ApiProperty({ description: '作品状态：0-普通，1-冠军', enum: WorkStatus, required: false })
  @IsOptional()
  @IsEnum(WorkStatus, { message: '无效的作品状态' })
  @Type(() => Number)
  status?: WorkStatus

  @ApiProperty({ description: '标签ID', required: false, example: 1 })
  @IsOptional()
  @IsInt({ message: '标签ID必须是整数' })
  @Type(() => Number)
  tagId?: number

  @ApiProperty({ description: '标签类型：champion-冠军作品，popular-热门作品，theater-剧场作品', required: false, example: 'theater' })
  @IsOptional()
  @IsString()
  tabType?: string
} 